class PrintChar{
  constructor(){

  }
  for1(n) {
    for (let i = 0; i <n;  i++) {
      let s = 'A';
      for (let j = 0; j < i; j++) {
        s += 'A';
      }
      console.log(s);
    }
  }
  for2(n) {
    for (let i = n; i > 0;  i--) {
      let s = 'A';
      for (let j = 1; j < i; j++) {
        s += 'A';
      }
      console.log(s);
    }
  }
  for3(n) {
    for (let i = n; i > 0;  i--) {
      if(i % 2 != 0 ){
        continue;
      }
      let s = 'A';
      for (let j = 1; j < i; j++) {
        s += 'A';
      }
      console.log(s);
    }
  }
  for4(n) {
    for (let i = n; i > 0;  i--) {
      let s = 'A';
      let j = 1;
      for (; j < i; j++) {
        s = ' ' + s;
      }
      // 最后一行打A
      if(i == 1){
        for(let k = (n - j) * 2 - 1; k > 0; k--){
          s += 'A';
        }
      }else{// 其余行数打空格
        for(let k = (n - j) * 2 - 1; k > 0; k--){
          s += ' ';
        }
      }

      if(n != j){
        s += 'A';
      }else{
      }
      console.log(s);
    }
  }
}

let print = new PrintChar();
print.for1(10);
console.log('');
print.for2(10);
console.log('');
print.for3(10);
console.log('');
print.for4(10);
